package com.feixiang.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;


@Entity
@Table(name="t_userInfo")
public class UserInfo implements Serializable {

	private static final long serialVersionUID = -6327759425294399374L;
	@Id
	@GenericGenerator(name="pkGenerator",strategy="foreign",parameters={
			@Parameter(value="user", name = "property")
	})
	@GeneratedValue(generator="pkGenerator")
	private Integer userId;
	@Column(length=20,nullable=false)
	private String name;
	@Column(length=200)
	private String address;
	@OneToOne(cascade=CascadeType.ALL,mappedBy="userInfo")
	private User user;
	
	public UserInfo() {
	}
	public UserInfo(Integer userId, String name, String address, User user) {
		this.userId = userId;
		this.name = name;
		this.address = address;
		this.user = user;
	}
	@Override
	public String toString() {
		return "UserInfo [userId=" + userId + ", name=" + name + ", address="
				+ address + "]";
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
}
